import java.util.regex.Matcher;
import java.util.regex.Pattern;

import static androidx.core.util.PatternsCompat.AUTOLINK_WEB_URL;

public class RegexMatches {
    public static void main(String args[]) {

//        // 按指定模式在字符串查找
//        String line = "fdsfsfwww.baidu.com";
//        String pattern = "^(?:https?://)?[\\\\w]{1,}(?:\\\\.?[\\\\w]{1,})+[\\\\w\\-_/?&=#%:]*$";
//
//        // 创建 Pattern 对象
//        Pattern r = Pattern.compile(pattern);
//
//        // 现在创建 matcher 对象
//        Matcher m = r.matcher(line);
//        if (m.find()) {
//            System.out.println("Found value: " + m.group(0));
//            System.out.println("Found value: " + m.group(1));
//            System.out.println("Found value: " + m.group(2));
//            System.out.println("Found value: " + m.group(3));
//        } else {
//            System.out.println("NO MATCH");
//        }
//    }

        System.out.print(getCompleteUrl("https://blog.csdn.net/flysongpeng/article/details/7527153????东方舵手大额发送https://blog.csdn.net/flysongpeng/article/details/7527152"));
}


    public static String getCompleteUrl(String text) {
//        Pattern p = Pattern.compile("((http|ftp|https)://)(([a-zA-Z0-9\\._-]+\\.[a-zA-Z]{2,6})|([0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}))(:[0-9]{1,4})*(/[a-zA-Z0-9\\&%_\\./-~-]*)?", Pattern.CASE_INSENSITIVE);
       Pattern p=AUTOLINK_WEB_URL;

        Matcher matcher = p.matcher(text);
        matcher.find();
        return matcher.group();
    }


}